<!DOCTYPE html>
<html class="x-admin-sm">
<head>
    <meta charset="UTF-8">
    <title>欢迎页面-X-admin2.2</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <link rel="stylesheet" href="../statics/plugins/layui/css/layui.css">
    <link rel="stylesheet" href="../statics/css/font.css">
    <link rel="stylesheet" href="../statics/css/xadmin.css">
</head>
<body>
<div class="layui-fluid">
    <div class="content h100 layui-col-space15">
        <!--登录头部-->
        <div class="layui-col-md12">
            <div class="layui-card">
                <div class="layui-card-body ">
                    <blockquote class="layui-elem-quote">欢迎您：
                        <span class="x-red x_red"></span>！当前时间:<span class='time'></span>
                    </blockquote>
                </div>
            </div>
        </div>
        <div class="layui-col-md12">
            <div class="layui-card">
                <div class="layui-card-header">通知公告</div>
                <div class="layui-card-body ">
                    <div class="layui-row titleMessage">
                        
                    </div>
                </div>
            </div>
        </div>
        <!--开发团队-->
        <div class="layui-col-md12">
            <div class="layui-card">
                <div class="layui-card-header">开发团队</div>
                <div class="layui-card-body ">
                    <table class="layui-table">
                        <tbody>
                            <tr>
                                <th>版权所有</th>
                                <td>君正方华
                                    <!--<a href="http://x.xuebingsi.com/" target="_blank">访问官网</a>-->
                                </td>
                            </tr>
                            <tr>
                                <th>开发者</th>
                                <td>韩鹏 , 王泓睿 , 李俊杰 , 闫梓璇</td>
                            </tr>
                        </tbody>
                    </table>
                </div>
            </div>
        </div>
    </div>
</div>
</body>
<script src="../statics/plugins/layui/layui.js" charset="utf-8"></script>
<script src='../statics/plugins/jQuery-3.2.1/jquery-3.2.1.min.js'></script>
<script src="../statics/plugins/X-admin/xadmin.js"></script>
<script src="../statics/js/public.js?v=1129"></script>
<script>
    var name=$.parseJSON(localStorage.getItem('login_msg')).username;
    $('.x_red').html(name);
    var time=fomDate('yyyy-mm-dd HH:MM:SS');
    $('.time').html(time);
    setInterval(function(){
        var time=fomDate('yyyy-mm-dd HH:MM:SS');
        $('.time').html(time);
    },1000);
    $.ajax({
        url:url+'/setting/notice/showLists',
        type:"post",
        data:{
            token: $.parseJSON(localStorage.getItem('login_msg')).token
        },
        success:function(r){
            if(r.code==100000){
                var div='';
                for(var i=0;i<r.data.length;i++){
                    div+=`
                        <div class="layui-col-xs12" data-id=${r.data[i].id}>
                            <div class="layui-col-xs10">
                                <span>${r.data[i].title}</span>
                            </div>
                            <div class="layui-col-xs2 text-right">
                                <span>${r.data[i].updateTime}</span>
                            </div>
                        </div>
                    `
                }
                $('.titleMessage').html(div);
            }
        }
    })
    $('body').on('click','.titleMessage .layui-col-xs12',function(){
        var id=$(this).data('id');
        $.ajax({
            url:url+'/setting/notice/showInfo',
            type:"post",
            data:{
                id:Number(id),
                token: $.parseJSON(localStorage.getItem('login_msg')).token
            },
            success:function(r){
                if(r.code==100000){
                    layui.use('layer', function() {
                        var layer = layui.layer;
                        layer.open({
                            type: 1,
                            title:r.data.title,
                            area: ["60%", '60%'],
                            content:`
                                <div class='layui-row' style="padding:15px">
                                    <div class='layui-col-xs12'>
                                        ${r.data.content}
                                    </div>
                                </div>
                            `,
                            btn: ['关闭'],
                            skin: 'my-skin'
                        })
                    });
                }else{
                    layui.use('layer', function() {
                        var layer = layui.layer;
                        layer.open({
                            type: 1,
                            title: "通知公告",
                            area: ["40%", '30%'],
                            content:`${r.msg}`,
                            btn: ['关闭'],
                            skin: 'my-skin'
                        })
                    });
                }
            }
        })
    })
</script>
</html>